Frontier 5: IdleTime Init
The IdleTime Init gives Mac users an additional verb: clock.idleTime ().This verb returns the number of seconds since the user has taken action -- such as typing, moving the mouse, and so on.
Installing
- Drop the IdleTime Init on your System Folder.
- Your Macintosh will ask you if the IdleTime Init can be put in the Extensions folder: click OK.
- Re-start your computer.
What you can do with it
A common use of the clock.idleTime verb is to run tasks that should only be run when the user is not doing anything.
You may have a task that takes up a fair amount of processing power. Or you may have a task that puts up windows on the screen. Those kinds of tasks would get in the way of a user's getting their work done.
Example
If you're running a Macintosh webserver such as WebSTAR or Quid Pro Quo you know that keeping your webserver application in front helps its performance.
You might write an agent script that automatically brings WebSTAR to front whenever you're not doing anything with the machine. You'd put a script in your system.agents table. Perhaps call it "webStarAgent."
It would look like this:
if clock.idleTime () > 5 * 60 // if idle for more than 5 minutes webStar.bringToFront () // bring WebSTAR to front clock.sleepFor (10) // let this agent "sleep" for 10 seconds before running againThis script brings WebSTAR to the front if the mouse or keyboard haven't been used for more than 5 minutes. The agent performs its check every ten seconds.
© Copyright 1996-98 UserLand Software. This page was last built on 6/17/98; 2:44:49 PM. It was originally posted on 1/29/98; 3:35:43 PM. Webmaster: webmaster@userland.com.